import { bsChalk } from '@/library/libs/bs-chalk'
import { IS_DEV } from './get-process-env'
import { loopCurry } from '@/library/libs/loop-curry'

const { printBaseInfo } = bsChalk

const printLog = loopCurry((
  isPrint: boolean,
  level: 'log' | 'warn' | 'error',
  component: string,
  message: string,
) => {
  if (isPrint) {
    bsChalk[level](`- [RT: ${component}]: ${message}`)
  }
})(IS_DEV)

const info = printLog('info')

const warn = printLog('warn')

const error = printLog('error')

export {
  printBaseInfo,
  bsChalk,
  info,
  warn,
  error,
}
